// src/router/platform.js

export const PLATFORM_CONFIG = {
  MERCHANT: {
    role: '_merchant',
    prefix: '/m', // 商户平台路由前缀
    loginPath: '/m/login',
    homePath: '/m/home',
    // notFoundPath: '/m/404'
  },
  SALES: {
    role: '_sales',
    prefix: '/s', // 销售平台路由前缀
    loginPath: '/s/login',
    homePath: '/s/home',
    // notFoundPath: '/s/404'
  },
  ADMIN: {
    role: 'admin',
    prefix: '/a', // 管理员平台路由前缀
    loginPath: '/a/login',
    homePath: '/a/home',
    // notFoundPath: '/a/404'
  },
};

// 根据角色获取平台配置
export function getPlatformConfigByRole(role) {
  return Object.values(PLATFORM_CONFIG).find(config => role?.endsWith(config?.role));
}

// 根据路由获取平台配置
export function getPlatformConfigByPath(path) {
  // console.log(role)
  return Object.values(PLATFORM_CONFIG).find(config => config.loginPath === path);
}